package com.androidx.p013lv.invention.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatRatingBar;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.invention.C1069R;
import java.util.List;

/* renamed from: com.androidx.lv.invention.adapter.TodayAdapter */
public class TodayAdapter extends BaseRecyclerAdapter<VideoBean, Holder> {
    String domain;
    Fragment fragment;

    public TodayAdapter(List<VideoBean> list, String str, Fragment fragment2) {
        this.list = list;
        this.domain = str;
        this.fragment = fragment2;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((VideoBean) this.list.get(i), i);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(C1069R.C1074layout.item_today, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.androidx.lv.invention.adapter.TodayAdapter$Holder */
    public class Holder extends BaseRecyclerHolder {
        ImageView iv_cover;
        AppCompatRatingBar rating_bar;
        RelativeLayout rl_item;
        TextView tv_num;
        TextView tv_recommend;
        TextView tv_subtitle;
        TextView tv_title;

        public Holder(View view) {
            super(view);
            this.tv_title = (TextView) view.findViewById(C1069R.C1072id.tv_title);
            this.tv_num = (TextView) view.findViewById(C1069R.C1072id.tv_num);
            this.tv_recommend = (TextView) view.findViewById(C1069R.C1072id.tv_recommend);
            this.rating_bar = (AppCompatRatingBar) view.findViewById(C1069R.C1072id.rating_bar);
            this.tv_subtitle = (TextView) view.findViewById(C1069R.C1072id.tv_subtitle);
            this.iv_cover = (ImageView) view.findViewById(C1069R.C1072id.iv_cover);
            this.rl_item = (RelativeLayout) view.findViewById(C1069R.C1072id.rl_item);
        }

        public void setData(VideoBean videoBean, int i) {
            RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) this.rl_item.getLayoutParams();
            if (i == 0) {
                layoutParams.leftMargin = UiUtils.dp2px(3);
            } else {
                layoutParams.leftMargin = 0;
            }
            this.rl_item.setLayoutParams(layoutParams);
            if (videoBean.getActress() == null || videoBean.getActress().size() <= 0) {
                this.tv_title.setText("素人");
            } else {
                this.tv_title.setText(videoBean.getActress().get(0).getActressName());
            }
            TextView textView = this.tv_num;
            textView.setText((i + 1) + "");
            TextView textView2 = this.tv_recommend;
            textView2.setText("看点：" + videoBean.getReason());
            this.rating_bar.setRating(((float) videoBean.getRecScore()) / 2.0f);
            this.tv_subtitle.setVisibility(8);
            if (videoBean.getCoverImg() == null || videoBean.getCoverImg().size() <= 0) {
                GlideUtils.loadCropRadiusDefault(TodayAdapter.this.fragment, 4, this.iv_cover);
                return;
            }
            Fragment fragment = TodayAdapter.this.fragment;
            GlideUtils.loadCropRadiusWh2(fragment, TodayAdapter.this.domain + videoBean.getCoverImg().get(0), 4, this.iv_cover, 600);
        }
    }
}
